package com.vincent.kdp.ui.commodity.repository;

import android.content.Context;
import android.telephony.TelephonyManager;
import com.loopj.android.http.RequestParams;
import com.vincent.baseapp.util.SPUtil;
import com.vincent.kdp.PostUrl;
import com.vincent.kdp.bean.ApiResponse;
import com.vincent.kdp.bean.GoodsListBean;
import com.vincent.kdp.bean.GoodsStatus;
import com.vincent.kdp.http.HttpUtil;
import com.vincent.kdp.http.RequestCallBack;
import com.vincent.kdp.ui.Constants;
import com.vincent.kdp.ui.bean.response.BaseOutput;
import com.vincent.kdp.ui.bean.response.CommodityDetailOutput;
import com.vincent.kdp.ui.bean.response.GetSalesRecordOutput;
import com.vincent.kdp.ui.bean.response.LikeCommodityOutput;
import com.vincent.kdp.util.BaseParam;

public class CommodityDetailRepository {
    /**
     * 获取商品详细信息
     *
     * @param barCode  商品编码
     * @param number 设备号
     * @param callBack 回调方法
     */
    public void reqCommodityDetail(String barCode, String number , RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("barCode", barCode);
        params.put("number", number);
        HttpUtil.loadData(PostUrl.GET_COMMODITY_DETAIL, params, CommodityDetailOutput.class, callBack);
    }
    /**
     * 获取商品状态
     *
     * @param barCode  商品编码
     * @param number 设备号
     * @param callBack 回调方法
     */
    public void reqCommodityStatus(String barCode, String number , RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("barCode", barCode);
        params.put("number", number);
        HttpUtil.loadData(PostUrl.GET_COMMODITY_DETAIL, params, GoodsStatus.class, callBack);
    }
    /**
     * 收货批次查询收货列表
     *
     * @param batchCode  商品编码
     * @param number 设备号
     * @param callBack 回调方法
     */
    public void reqCommodityList(String batchCode, String number , RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("batchCode", batchCode);
        params.put("number", number);
        HttpUtil.loadData(PostUrl.RECEIVE_GOODS_BACHCODE, params, GoodsListBean.class, callBack);
    }
    /**
     * 获取猜你喜欢的商品列表
     *
     * @param callBack 回调方法
     */
    public void reqLikeCommodityList(RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("departId", SPUtil.getString(Constants.SPKeys.DEPART_ID));
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_LIKE_COMMODITY_LIST, params, LikeCommodityOutput.class, callBack);
    }


    public void increaseLookTimes(String barCode,RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("barCode", barCode);
        params.put("number", BaseParam.getDeviceId());

        HttpUtil.loadData(PostUrl.INCREASE_LOOK_TIMES, params, BaseOutput.class, callBack);
    }

    public void getSalesRecordByBarCode(String barCode,RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("barCode", barCode);
        params.put("number", BaseParam.getDeviceId());

        HttpUtil.loadData(PostUrl.GET_SALES_RECORD_BY_BARCODE, params, GetSalesRecordOutput.class, callBack);
    }

    //传入参数
    public void addIdToService(){

    }


}
